***********************************************************
******************** Master do file ***********************
***********************************************************
*** Replication materials for:
*** Fiva, Jon H. and Hix, Simon 
*** "Electoral Reform and Strategic Coordination" 
*** British Journal of Political Science

/* the following packages needs to be installed */
*ssc install estout

local path = "C:/Users/A0910846/Dropbox/FivaHix/BJPOLS_Replication"
cd `path'
cap mkdir "`path'/tables"
cap mkdir "`path'/figures"
cap mkdir "`path'/figures/gph"
cap mkdir "`path'/figures/Figure2"
cap mkdir "`path'/figures/FigureA7"
cap mkdir "`path'/figures/FigureA8"
cap mkdir "`path'/Tables/Table1"
cap mkdir "`path'/Tables/TableA2"
cap mkdir "`path'/Tables/TableA4"
cap mkdir "`path'/Tables/TableA5"
cap mkdir "`path'/Tables/TableA6"

***********************************************************
******************** Data preparation *********************
***********************************************************
run do/Storting1921.do   /* import municipality level votes from 1921 */
run do/Storting1924.do   /* import municipality level votes from 1924 */
run do/Storting1927.do   /* import municipality level votes from 1927 */
run do/ImportVotesParty.do /* Combine cross-sections 1909, 1912, ..., 1927 */
run do/CreatePanel.do /* Create MunicipalityLevel.dta and SMDLevel.dta  */
run do/StableSample.do /* Identify 42 SMDs */
run do/SupplySideAdjustments.do /* Import Fiva and Smith (2017, WEP) data on candidate occupation */

***********************************************************
******************** Figures ******************************
***********************************************************
run do/Figure1.do /* Figure 1: Vote-trading between blocs between 1918 and 1921 */
run do/Figure2.do /* Figure 2: Vote-trading in reform and non-reform years */

***********************************************************
******************** Appendix Figures *********************
***********************************************************
run do/FigureA1.do /* Figure A1: Vote-shares and seat-shares across blocs */
run do/FigureA2.do /* Figure A2: The (effective) number of parties before and after PR */
run do/FigureA3.do /* Figure A3: Fraction of SMDs Contested by Party */
****   Figure A4 -- PDF Example: Nordland city district */
****   Figure A5 -- PDF Example: Nordland county district */
run do/FigureA6.do /* Figure A6: Candidates' occupational background by party bloc over time */
run do/FigureA7.do /* Figure A7: Vote-trading in reform and non-reform years: Liberal advantage over Labor */
run do/FigureA8.do /* Figure A8: Vote-trading in reform and non-reform years: Labor advantage over Conservatives */
run do/FigureA9.do /* Figure A9: Vote-shares across blocs, split by top-two status 1918 */
run do/FigureA10.do /* Figure A10: Pre-reform partisan advantage and voter turnout */

***********************************************************
******************** Tables *******************************
***********************************************************
run do/Table1.do /* Table 1: Vote-trading between blocs 1918 and 1921 [with and without clustering] */

***********************************************************
******************** Appendix Tables **********************
***********************************************************
run do/TableA1.do /* Table A1: Description of estimation samples using data from 1918 election */
run do/TableA2.do /* Table A2: Aggregate level analysis of how electoral reform impacts ENoP */
run do/TableA3.do /* Table A3: Vote-trading between blocs between 1918 and 1921: Regression analysis when controlling for changes in candidate occupations at the district-bloc level */
run do/TableA4.do /* Table A4: Vote-trading between blocs between 1918 and 1921: Regression analysis when controlling for pre-reform voter turnout [with and without clustering] */
run do/TableA5.do /* Table A5: Top-two reform analysis */
run do/TableA6.do /* Table A6: Top-two placebo analysis */
